package ar.edu.unq.wannaplay.utils;

import java.util.HashMap;
import java.util.Map;

import ar.edu.unq.wannaplay.builders.Builder;
import ar.edu.unq.wannaplay.builders.CareerPlanOrganizerBuilder;
import ar.edu.unq.wannaplay.builders.ClientBuilder;
import ar.edu.unq.wannaplay.builders.EmployeeBuilder;
import ar.edu.unq.wannaplay.builders.LicenceSpitterBuilder;
import ar.edu.unq.wannaplay.builders.ProjectBuilder;
import ar.edu.unq.wannaplay.builders.UserBuilder;
import ar.edu.unq.wannaplay.persistence.daos.CareerPlanOrganizerDAO;
import ar.edu.unq.wannaplay.persistence.daos.ClientDAO;
import ar.edu.unq.wannaplay.persistence.daos.EmployeeDAO;
import ar.edu.unq.wannaplay.persistence.daos.LicenceSpitterDAO;
import ar.edu.unq.wannaplay.persistence.daos.ProjectDAO;
import ar.edu.unq.wannaplay.persistence.daos.UserDAO;

public class BuilderManager {
    private Map<Class<?>, Builder> builders = this.initBuilders();

    private Map<Class<?>, Builder> initBuilders() {
        Map<Class<?>, Builder> map = new HashMap<Class<?>, Builder>();
        map.put(EmployeeDAO.class, new EmployeeBuilder());
        map.put(ProjectDAO.class, new ProjectBuilder());
        map.put(CareerPlanOrganizerDAO.class, new CareerPlanOrganizerBuilder());
        map.put(ClientDAO.class, new ClientBuilder());
        map.put(LicenceSpitterDAO.class, new LicenceSpitterBuilder());
        map.put(UserDAO.class, new UserBuilder());

        return map;
    }

    public Builder getBuilder(final Class<?> daoClass) {
        return builders.get(daoClass);
    }

    public Map<Class<?>, Builder> getBuilders() {
        return builders;
    }

    public void setBuilders(final Map<Class<?>, Builder> builders) {
        this.builders = builders;
    }

}
